while True:
    s = input("变量名")
    if s == "exit":
        print("欢迎下次使用")
        break
    if s[0].isalpha() or s[0] == "_":
        for i in s[1:]:
            if not (i.isalnum() or i == "_"):
                print("%s变量名不合法"%s)
                break
            else:
                print("%s变量名合法"%s)
    else:
        print("%s变量名不合法"%s)



sen = input().split()
print(" ".join(sen[::-1]))
print(" ".join(input().split()[::-1]))



from string import Template
width =30
price_width=15
item_width=width-price_width
header_format='%-*s%*s'
content_format='%-*s%*.2f'
print('='*width)
print (header_format%(item_width,'项目',price_width,'价格'))
print("-"*width)
print(content_format%(item_width,"苹果",price_width,6))
print(content_format%(item_width,"橘子",price_width,3.2))
print(content_format%(item_width,"香蕉",price_width,2.5))
print(content_format%(item_width,'葡萄',price_width,14.8))
print(content_format%(item_width,'红提',price_width,15))
print(content_format%(item_width,'西瓜',price_width,1.5))
print('='*width)



a1=1/2
q=1/2
s=0
n=99
for i in range(n):
    s += a1*q**i
    print(s)



def fib(n):
    a, b = 1, 1
    for i in range(n-1):
        a, b = b, a+b
    return a
print (fib(50))



def fib(n):
    if n == 1:
        return [1]
    if n == 2:
        return [1, 1]
    fibs = [1, 1]
    for i in range(2, n):
        fibs.append(fibs[-1] + fibs[-2])
    return fibs
print(fib(50))
